package io;

import java.io.*;
import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("node.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        //创建 PrintWriter时
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请开始输入内容，为exit时退出");
        while(true){
            String str =scanner.nextLine();
            if("exit".equalsIgnoreCase(str)){
                break;
            }
            pw.println(str);
        }
        System.out.println("再见!");
        pw.close();
    }
}

























